package com.visionvera.retrofitservice.dialog;

import android.app.Dialog;
import android.content.Context;

/**
 * Description:
 */

public class CommonDialogUtils {
    //  加载进度的dialog
    private Dialog mProgressDialog;

    /**
     * 显示ProgressDialog
     */
    public void showProgress(Context context, String msg) {
        if (mProgressDialog == null) {
            mProgressDialog = CustomProgressDialog.createLoadingDialog(context, msg);
        }
        if (mProgressDialog != null && !mProgressDialog.isShowing()) {
            mProgressDialog.show();
        }
    }

    /**
     * 显示ProgressDialog
     */
    public void showProgress(Context context) {
        if (mProgressDialog == null) {
            mProgressDialog = CustomProgressDialog.createLoadingDialog(context, "");
        }
        if (mProgressDialog != null && !mProgressDialog.isShowing()) {
            mProgressDialog.show();
        }
    }

    /**
     * 取消ProgressDialog
     */
    public void dismissProgress() {
        if (mProgressDialog != null && mProgressDialog.isShowing()) {
            mProgressDialog.dismiss();
        }
    }
}
